Argument Of Type String | Null Is Not Assignable To

[Solved] Argument Of Type String | Null Is Not Assignable To | Solidity - Code Explorer | yomemimo.com
Question : Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'.

Answered by : crazy-cicada-s647621we6xq

JSON.parse(localStorage.getItem('user') as string);
or
JSON.parse(localStorage.getItem('user') as any);

Source : | Last Update : Fri, 29 Jul 22

Question : Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'.

Answered by : sarthhak-kachwha

Argument of type 'string | null' is not assignable to parameter of type 'string'. Type 'null' is not assignable to type 'string'. route.paramMap.get('id')
ANS-
route.paramMap.get('id')!

Source : | Last Update : Fri, 20 May 22

Answers related to argument of type string | null is not assignable to parameter of type string type null is not assignable to type string

Code Explorer Popular Question For Solidity